
package botlab.gui.levelchooser.actionlistener;

import botlab.GameManager;
import botlab.gui.GUI;
import botlab.gui.levelchooser.JSlideShowLabel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author Quentin
 */
public class CancelActionListener implements ActionListener
{
    private GUI gui;
    private JSlideShowLabel panel;
    
    public CancelActionListener(JSlideShowLabel ssp,GUI gui)
    {
        this.panel=ssp;
        this.gui=gui;
    }

    public void actionPerformed(ActionEvent e)
    {
        if(GameManager.getInstance().getGame().getCurrentLevel()!=null)
        {
            gui.setMode(GUI.EDITOR);
            panel.reset();
        }
        else
        {
            GameManager.getInstance().getGame().stop(true);
            System.exit(0);
        }
            
            
    }
    
}
